package com.gcl.usercenter.exception;

import com.gcl.usercenter.common.ErrorCode;

public class BusinessException extends RuntimeException{
    private static final long serialVersionUID = -7888693081355800660L;
    private final int code;
    private String description = "";

    public BusinessException(String message, int code,String description) {
        super(message);
        this.code = code;
        this.description = description;
    }

    public BusinessException(ErrorCode errorCode, String description){
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = description;

    }

    public BusinessException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
